//////////////////////////////////////////////////////////////////////////
/// Copyright (c) 2011, Sidorenko 'PC' Alexander                       ///
/// mailto: sidorenko /*dot*/ alexander (at) gmail [dot] com           ///
/// This file is a part of the Radiating Gas Dynamics project          ///
//////////////////////////////////////////////////////////////////////////

#pragma once

#include "Timeline.h"
#include "ColorBar.h"

class Problem;

// CRGDDlg dialog. This class represents MFC-based GUI of the application
class CRGDDlg : public CDialog
			  , public CTimelineListener
{
// Construction
public:
	CRGDDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_RGD_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	virtual void OnOK();
	virtual void OnCancel();
	
	virtual void OnPlotTypeChanged();
	virtual void OnTimeChanged(gdScalar factor);

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg void OnHelpAbout();
	afx_msg void OnSimulationDiscardsolution();
	afx_msg void OnUpdateSimulationDiscardsolution(CCmdUI *pCmdUI);
	afx_msg void OnSimulationExit();
	afx_msg void OnSimulationOpenFile();
	afx_msg void OnSimulationStartnewSphere();
	afx_msg void OnSimulationStartnewCylinder();
	afx_msg void OnSimulationStartnewSod();
	afx_msg void OnSimulationStartnewSod2d();
	afx_msg void OnSimulationStartnewBrick();
	afx_msg void OnClose();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnDestroy();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	DECLARE_MESSAGE_MAP()

private:

	void ResizeTimeline();

	void DrawCurrentSolution();

	Problem *m_problem;

	CTimeline m_timeline;

	unsigned int m_timelineHeight;
	CRect m_drawRect;

	CColorBar m_jetColor;

public:
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);

	gdScalar m_timeFactor;
	afx_msg void OnStartnewBunchoftests();
	afx_msg void OnSimulationSaveavi();
};
